import java.util.Scanner;
public class Test4 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String S="A man, a plan, a canal: Panama";
        boolean result=isPalindrome(S);
        System.out.println(result);
    }
    public static boolean isNumberorChar(char ch){
        if(ch>='0'&&ch<='9'||ch>='a'&&ch<='z'){
            return true;
        }
        return false;
    }
    public static boolean isPalindrome(String s){
        s=s.toLowerCase();
        int i=0;
        int j=s.length()-1;
        while (i<j){
            while (i<j&&!isNumberorChar(s.charAt(i))){
                i++;
            }while (i<j&&!isNumberorChar(s.charAt(j))){
                j--;
            }
            if(s.charAt(i)!=s.charAt(j)){
                return  false;
            }else {
                i++;
                j--;
            }
        }
        return true;
    }
}
